function XForms_submission(params,instanceData){
  XForms_Core.call(this, params);
  XForms.binds[this.getUID()]=this;
  var control=this;
  this.getInstanceData=function(){
    return XForms.binds[instanceData];
  }
  this.submit=function(){
    var xmlData = control.getInstanceData().toXml(undefined,true);
    var validacion =control.getInstanceData().validate();
    $(".xforms_validationmessage:not(:empty)").empty();
    if(validacion.length==0){
      $.ajax({
        url:params.resource,
        type:params.method,
        dataType:"xml",
        data:{xml:xmlData},
        success:function(res){
          window.open("submit.php?t="+(new Date().getTime()), "submit");
        }
      });
    } else {
      for(var i=0,l=validacion.length;i<l;i++){
        validacion[i].control.validationMessage("Field required.");
        if(i==0) {
          var $e=validacion[i].control.$element;
          $('html, body').animate({ scrollTop: validacion[i].control.$element.offset().top -32 }, 'slow', 'swing', function(){
            $e.focus();
          });
        }
      }
      $( ".orbeonPanel" ).accordion( "refresh" );
    }
  }
}
